<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"><meta name="format-detection" content="telephone=no">
	<title>exmobi-pattern</title>
	<link rel="stylesheet" href="../assets/agile/css/agile.layout.css">
<link rel="stylesheet" href="../assets/third/seedsui/plugin/seedsui/seedsui.min.css">
</head>

<body>
<div id="section_container">
	<section data-role="section" id="page_exmobi_pattern" class="active">
		<header>
		    <div class="titlebar">
		        <a href="javascript:Exmobi.close()"><i class="icon icon-arrowleft"></i></a>
		        <h1>手势密码</h1>
		    </div>
		</header>
		<article id="main_article" data-role="article" class="active">
			<a class="button block margin8 info" href="javascript:setPattern()">设置或修改手势密码</a>
			<a class="button block margin8 cancel" href="javascript:cancelPattern()">取消手势密码</a>
		</article>
	</section>
</div>
<!--- third -->
	<script src="../assets/third/jquery/jquery-2.1.3.min.js"></script>
	<script src="../assets/third/jquery/jquery.mobile.custom.min.js"></script>
	<!---  agile -->
	<script type="text/javascript" src="../assets/agile/js/agile.js"></script>
<script type="text/javascript" src="../assets/bridge/exmobi.js"></script>
<script type="text/javascript" src="../assets/bridge/agile.exmobi.js"></script>			
	<!-- app -->
	<script type="text/javascript" src="../assets/app/js/app.seedsui.js"></script>
	
	
    
    
    
    
    
	<script>
		function setPattern(){
			//判断是否开启手势密码
			var isPattern = PatternUtil.isPattern();
			if(isPattern){
				PatternUtil.openPattern(lockPatternCallback);//设置手势函数
				return;
			}
			mergePattern();
		}
		function lockPatternCallback(){
			var toast = new Toast();
		 	toast.setText("解锁成功");
			toast.show();
			mergePattern();
		}
		function mergePattern(){
			//设置手势密码
			PatternUtil.enablePattern();
			PatternUtil.setPatternForgetUrl("http://exmobi.cn/");
			PatternUtil.setPatternTimeout(1);
			PatternUtil.openSetPattern(mergePatternCallBack);//设置手势函数
		}
		function mergePatternCallBack(result){
			var toast = new Toast();
			if(!result){
				toast.setText("您已取消设置");
			}
			else{
				toast.setText("设置成功");
			}
			toast.show();
		 }
		 function cancelPattern(){
		 	var toast = new Toast();
		 	toast.setText("您已取消手势密码");
			PatternUtil.disablePattern();
			toast.show();
		 }
		
		function back(){Exmobi.close();}
	</script>
</body>
</html>
